﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpPickInterface.h"
#include "IPickContext.h"
#include "Vector3d.h"

namespace gcmp {
    class ILine3d;
    class IPickFilter;
    class IPickEvent;
    /// \brief 按点拾取上下文，是按点拾取的输入信息
    class GCMP_PICK_INTERFACE_EXPORT IPointPickContext : public IPickContext
    {
        DEFINE_CAST_DERIVED(gcmp::IPointPickContext, gcmp::IPickContext);
    public:

        /// \brief 产生默认的按点拾取上下文
        /// \return 按点拾取上下文
        static OwnerPtr<IPointPickContext> Create();

        /// \brief 设置拾取射线
        /// \param ray 拾取射线
        /// \return 成功返回true，失败返回false
        virtual bool SetRay(const gcmp::ILine3d* ray) = 0;

        /// \brief 设置拾取容差
        /// \param tolerance 拾取容差
        /// \return 成功返回true，失败返回false
        virtual bool SetPickTolerance(double tolerance) = 0;
        
        /// \brief 设置大场景判断标准中图形表达数量的阈值，内部默认值是10000
        ///        判断标准：视图中grep数量 > threshold，则认为是大场景，也对应大场景下的拾取容差
        /// \param threshold 阈值
        /// \return 成功返回true，失败返回false
        virtual bool SetGrepSizeThresholdForLargeScene(unsigned threshold) = 0;

        /// \brief 获取大场景判断标准中图形表达数量的阈值
        ///        判断标准：视图中grep数量 > threshold，则认为是大场景，也对应大场景下的拾取容差
        /// \return 图形表达数量的阈值
        virtual unsigned GetGrepSizeThresholdForLargeScene() const = 0;

        /// \brief 设置大场景下的拾取容差
        /// 
        /// \param tolerance 拾取容差
        /// \return 成功返回true，失败返回false
        virtual bool SetPickToleranceForLargeScene(double tolerance) = 0;

        /// \brief 获取大场景下的拾取容差
        /// 
        /// \return 拾取容差
        virtual double GetPickToleranceForLargeScene() const = 0;

        /// \brief 设置拾取鼠标位置
        /// \param mousePosition 鼠标位置
        /// \return 成功返回true，失败返回false
        virtual bool SetMousePosition(const Vector3d& mousePosition) = 0;

        /// \brief 设置拾取滤波器,用于过滤不希望被拾取到的元素或图形节点
        /// \param pPickFilter 拾取滤波器
        /// \return 成功返回true，失败返回false
        virtual bool SetPickFilter(const IPickFilter* pPickFilter) = 0;

        /// \brief 设置拾取后处理事件,用于对拾取结果进行后处。
        /// 该事件被触发时机：拾取完成返回拾取结果之前。
        /// \param pPickEvent 拾取后处理事件
        /// \return 成功返回true，失败返回false
        virtual bool SetPickPostProcessEvent(const IPickEvent* pPickEvent) = 0;

        /// \brief 设置收集被IPickFilter过滤掉的GNodeRef
        ///
        /// \param value true表示收集，false表示不收集
        /// \return 成功返回true，失败返回false
        virtual bool SetCollectPickResultsFiltered(bool value) = 0;

        /// \brief 获取是否收集被IPickFilter过滤掉的GNodeRef
        /// \return true表示收集，false表示不收集
        virtual bool IsCollectPickResultsFiltered() const = 0;

    };

}// namespace gcmp

